class CreateAssemblyOrderDetails < ActiveRecord::Migration
  def self.up
    create_table :assembly_order_details do |t|
      t.integer :assembly_order_id      ,:null => false            #这是详表所对应的主表ID
      t.integer :assembly_order_product_id      ,:null => false    #这是组合产品表所对应的ID
      t.integer :product_id             ,:null => false            #产品的编号
      t.integer :quantity      ,:default => 0     #数量
      t.string  :description                      #写一些备注之类的信息
      t.integer :is_locked     , :limit => 1  ,:default => 0   #锁定 1为True 0为False
      t.integer :lock_version  , :default => 0    #乐观锁
      t.timestamps
    end
  end

  def self.down
    drop_table :assembly_order_details
  end
end
